package com.heima.wemedia.controller.v1;


import com.heima.model.wemedia.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmSensitive;
import com.heima.wemedia.service.SensitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController {
    @Autowired
    SensitiveService sensitiveService;
    //分页查询
    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto dto){
      return   sensitiveService.listPage(dto);
    }
    //根据id删除
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteById(@PathVariable Integer id) {
       return sensitiveService.deleteById(id);
    }
    //保存
    @PostMapping("/save")
    public ResponseResult save(@RequestBody WmSensitive dto) {
        return sensitiveService.saveSensitive(dto);
    }
    //修改
    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmSensitive dto) {
        return sensitiveService.updateSensitive(dto);
    }
}
